package com.mx.mxweb.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mx.mxweb.dao.ResourcesMapper;
import com.mx.mxweb.model.Resources;
import com.mx.mxweb.service.ResService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * ${DESCRIPTION}
 *
 * @author 李和平
 * @create 2018-08-16 15:33
 **/

@Service
public class ResServiceImpl implements ResService {

    @Autowired
    private ResourcesMapper resourcesMapper;

    //条件查询  不查询全部!
    public PageInfo<Resources> seleteByKey(String key, Resources resService, int currentPage, int pageSize) {
        List<Resources> resourcesList = new ArrayList<Resources>();
        PageHelper.startPage(currentPage,pageSize);
        resourcesList = resourcesMapper.selectByKey(key);
        PageInfo<Resources> pageInfo = new PageInfo<Resources>(resourcesList);
        return pageInfo;
    }
}
